export default {
    // 输入框字符类型限制
    allowInput(val, type = {number: true, chinese: true, english: true, symbol: true, space: true}) {
        const allowNumber = type.number === false ? !/[0-9]/g.test(val) : true
        const allowChinese = type.chinese === false ? !/[\u4E00-\u9FA5\uF900-\uFA2D]/g.test(val) : true
        const allowEnglish = type.english === false ? !/[A-Za-z]/g.test(val) : true
        const allowSymbol = type.symbol === false ? !/[0-9]/g.test(val) : true
        const allowSpace = type.space === false ? !/\S+/g.test(val) : true

        return !val || (allowNumber && allowChinese && allowEnglish && allowSymbol && allowSpace)
    }
}
